<template>
  <div class="buy">
 <buy-head> </buy-head>
 <buy-nose> </buy-nose>
 <buy-body> </buy-body>
 <buy-foot> </buy-foot>
  </div>
</template>

<script>
import BuyHead from './components/BuyHead.vue'
import BuyNose from './components/BuyNose.vue'
import BuyBody from './components/BuyBody.vue'
import BuyFoot from './components/BuyFoot.vue'
import axios from 'axios'


export default {
  name:'buy',
  components:{
  BuyHead, 
  BuyNose,
  BuyBody, 
  BuyFoot
  },
 data: function(){
    return{
      iconList: [],
      recommendList: []
    }
  },
  mounted(){
    this.getHomeApiInfo()
  },
  methods: {
    getHomeApiInfo(){
      axios.get("/mock/beauty.json").then(this.getHomeResponseInfo)
    },
    getHomeResponseInfo(response){
      //  console.log(response.data);
      let res = response.data  //就是home.json里面的内容
      if(res.success && res.dataList){
        const data = res.dataList //取json中的datalist属性
        // console.log(data.iconLists.length)
        this.iconList = data.iconLists
        this.recommendList = data.recommendLists
      }
    }
  }

   
}

</script>
